package run.bottle.zookeeper;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;

public class ZKUtil {

    public static CuratorFramework cf() {
        //重试策略
        RetryPolicy retrySleeper = new ExponentialBackoffRetry(3000,2);
        CuratorFramework cf = CuratorFrameworkFactory.builder()
                .connectString("localhost:2181,localhost:2182,localhost:2183")
                .retryPolicy(retrySleeper)
                .build();

        cf.start();

        return cf;
    }

}
